home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Languages / MS Cobol4.5 / DEMO / SRTDEM.CMD < prev    next >
OS/2 REXX Batch file  |  1991-04-08  |  12KB  |  207 lines

  1. echo off
  2. rem    Batch File to Compile, Link and Run the SORTDEMO demonstration program.
  3. rem    This batch file can be run from your OS/2 prompt. If you specify the
  4. rem    "animate" parameter to the batch file then the SORTDEMO program will be
  5. rem    compiled, linked and then ANIMATED.
  6. rem                                                                 v 1.2.2
  7. cls
  8. echo .
  9. echo     *------------------* SORTDEMO demonstration program *-----------------*
  10. echo     *                                                                     *
  11. echo     * The SORTDEMO program demonstrates how to use OS/2 function calls    *
  12. echo     * in COBOL programs, and how to animate programs containing such      *
  13. echo     * calls. This batch stream will compile, link and run, or compile     *
  14. echo     * and animate the SORTDEMO program. To obtain animation, invoke this  *
  15. echo     * batch stream with the parameter, ANIMATE.                           *
  16. echo     *                                                                     *
  17. echo     * Please ensure that you have followed the installation instructions  *
  18. echo     * for COBOL, using SETUP to load the OS/2 compiler and the Microsoft  *
  19. echo     * Utilities, including the OS/2 specific files.                       *
  20. echo     *                                                                     *
  21. echo     * Press Ctrl+C to exit if you have NOT properly installed your        *
  22. echo     * COBOL Compiler, or copied the required files.                       *
  23. echo     *                                                                     *
  24. echo     *---------------------------------------------------------------------*
  25. echo .
  26. pause
  27. cls
  28. if %COBDIR%. == . goto errcob
  29. if not exist SORTDEMO.CBL goto errtic
  30. if %1. == animate. goto doanim
  31. if %1. == ANIMATE. goto doanim
  32. :
  33. if %1. == LCOBOL. if not exist %cobdir%\LCOBOL.LIB goto errlib
  34. if %1. == lcobol. if not exist %cobdir%\LCOBOL.LIB goto errlib
  35. if %1. == . if not exist %cobdir%\COBLIB.LIB goto errlib
  36. if %1. == . if not exist %cobdir%\COBLIB.DLL goto errlib
  37. cls
  38. echo     *---------------------------------------------------------------------*
  39. echo     *          Compiling the SORTDEMO demonstration program               *
  40. echo     *---------------------------------------------------------------------*
  41. echo on
  42. COBOL SORTDEMO.CBL OPTSPEED NOTRICKLE ;
  43. echo off
  44. if errorlevel 1 goto nocob
  45. echo     *---------------------------------------------------------------------*
  46. echo     *          Compilation of SORTDEMO has completed successfully         *
  47. echo     *---------------------------------------------------------------------*
  48. pause
  49. cls
  50. echo     *---------------------------------------------------------------------*
  51. echo     *                   Linking the SORTDEMO program                      *
  52. echo     *                                                                     *
  53. if %1. == lcobol. goto ltxtl
  54. if %1. == LCOBOL. goto ltxtl
  55. echo     *  The program will be linked to run with the shared run-time,        *
  56. echo     *  COBLIB. The EXE file created requires the file COBLIB.DLL to be    *
  57. echo     *  present in the current or COBOL system directories in order to     *
  58. echo     *  operate. (The directory must also be on your LIBPATH.)             *
  59. echo     *                                                                     *
  60. echo     *  Restart this batch file with the parameter, LCOBOL, to see the     *
  61. echo     *  program statically linked so that it is independent of any other   *
  62. echo     *  files at run-time. (i.e. enter SRTDEM LCOBOL)                      *
  63. goto ltxte
  64. :ltxtl
  65. echo     *  The program will be statically linked. That is, the COBOL run-time *
  66. echo     *  support required for this program is linked into the EXE file      *
  67. echo     *  making it independent of any other files at run-time.              *
  68. :ltxte
  69. echo     *                                                                     *
  70. echo     *---------------------------------------------------------------------*
  71. if %1. == LCOBOL. goto linkl
  72. if %1. == lcobol. goto linkl
  73. echo on
  74. LINK SORTDEMO/NOD,,,COBLIB+OS2;
  75. echo off
  76. goto linke
  77. :linkl
  78. echo on
  79. LINK SORTDEMO/NOD,,,LCOBOL+OS2;
  80. echo off
  81. :linke
  82. if errorlevel == 1 goto linkerr
  83. if not exist SORTDEMO.EXE goto linkerr
  84. echo     *---------------------------------------------------------------------*
  85. echo     *            Linking of SORTDEMO has completed successfully           *
  86. echo     *---------------------------------------------------------------------*
  87. pause
  88. cls
  89. echo     *---------------------------------------------------------------------*
  90. echo     *                         Running SORTDEMO                            *
  91. echo     *---------------------------------------------------------------------*
  92. echo on
  93. SORTDEMO
  94. echo off
  95. if errorlevel == 1 goto runerr
  96. cls
  97. echo .
  98. echo     *---------------------------------------------------------------------*
  99. echo     *                                                                     *
  100. echo     * For an example of how to Animate this program, and others using     *
  101. echo     * calls to OS/2 API functions, rerun this demo, but with a parameter  *
  102. echo     * of ANIMATE (i.e. enter SRTDEM ANIMATE)                              *
  103. echo     *                                                                     *
  104. echo     *---------------------------------------------------------------------*
  105. echo .
  106. goto endsort
  107. :doanim
  108. cls
  109. echo     *---------------------------------------------------------------------*
  110. echo     *     Compiling the SORTDEMO demonstration program for Animation      *
  111. echo     *---------------------------------------------------------------------*
  112. echo on
  113. COBOL SORTDEMO.CBL ANIM;
  114. echo off
  115. if errorlevel 1 goto nocob
  116. echo     *---------------------------------------------------------------------*
  117. echo     *          Compilation of SORTDEMO has completed successfully         *
  118. echo     *---------------------------------------------------------------------*
  119. pause
  120. cls
  121. echo     *---------------------------------------------------------------------*
  122. echo     *                    Animating the SORTDEMO program                   *
  123. echo     *                                                                     *
  124. echo     * The program calls VIO API functions. In order to ensure that these  *
  125. echo     * write to the user screen rather than the Animator screen, the       *
  126. echo     * FLASH-CALLS directives is used.                                     *
  127. echo     *                                                                     *
  128. echo     *---------------------------------------------------------------------*
  129. pause
  130. echo on
  131. ANIMATE SORTDEMO FLASH-CALLS
  132. echo off
  133. echo     *---------------------------------------------------------------------*
  134. echo     * If you terminated the Animation without completing the program your *
  135. echo     * screen may be in the wrong mode. You can restore the default mode   *
  136. echo     * using the "MODE" command. For example, enter                        *
  137. echo     *                  MODE CO80                                          *
  138. echo     *---------------------------------------------------------------------*
  139. goto endsort
  140. :nocob
  141. echo     ***********************************************************************
  142. echo     *                          *** ERROR ***                              *
  143. echo     *                                                                     *
  144. echo     * An error occured while compiling SORTDEMO. Please ensure that you   *
  145. echo     * have installed all the necessary files.                             *
  146. echo     *                                                                     *
  147. echo     ***********************************************************************
  148. goto endsort
  149. :linkerr
  150. echo     ***********************************************************************
  151. echo     *                          *** ERROR ***                              *
  152. echo     *                                                                     *
  153. echo     *    An error occured while linking. Please ensure that you have      *
  154. echo     *    correctly installed all the necessary files.                     *
  155. echo     *                                                                     *
  156. echo     ***********************************************************************
  157. goto endsort
  158. :runerr
  159. echo     ***********************************************************************
  160. echo     *                          *** ERROR ***                              *
  161. echo     *                                                                     *
  162. echo     *    An error occured while running. Please ensure that you have      *
  163. echo     *    correctly installed the COBOL system.                            *
  164. echo     *                                                                     *
  165. echo     ***********************************************************************
  166. goto endsort
  167. :errcob
  168. echo     ***********************************************************************
  169. echo     *                          *** ERROR ***                              *
  170. echo     *                                                                     *
  171. echo     * The COBDIR environment variable is not set. Please ensure that you  *
  172. echo     * have installed the COBOL system correctly.                          *
  173. echo     *                                                                     *
  174. echo     ***********************************************************************
  175. goto endsort
  176. :errtic
  177. echo     ***********************************************************************
  178. echo     *                          *** ERROR ***                              *
  179. echo     *                                                                     *
  180. echo     * The SORTDEMO program is not in the current directory. Either change *
  181. echo     * directory or copy SORTDEMO.CBL from your issue disks.               *
  182. echo     *                                                                     *
  183. echo     ***********************************************************************
  184. goto endsort
  185. :errlib
  186. echo     ***********************************************************************
  187. echo     *                          *** ERROR ***                              *
  188. echo     *                                                                     *
  189. if %1. == LCOBOL. goto los2l
  190. if %1. == lcobol. goto los2l
  191. echo     * One or both of the files COBLIB.LIB and COBLIB.DLL (the shared      *
  192. echo     * run-time) required for linking and running this program are         *
  193. goto los2e
  194. :los2l
  195. echo     * The file, LCOBOL.LIB, needed for statically linking this program is *
  196. :los2e
  197. echo     * not in the COBOL system directory (identified by the environment    *
  198. echo     * variable, COBDIR). The link processes in this batch stream will     *
  199. echo     * not work correctly without these files. Please load them into the   *
  200. echo     * COBOL system directory before restarting SRTDEM.                    *
  201. echo     *                                                                     *
  202. echo     ***********************************************************************
  203. :endsort
  204. echo     *---------------------------------------------------------------------*
  205. echo     *                   End of SORTDEMO Demonstration                     *
  206. echo     *---------------------------------------------------------------------*
  207.